package com.huarui.initial.dao.impl;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import org.ewaf.framework.dao.impl.BaseDaoImpl;

import com.huarui.initial.dao.IInitialDao;
import com.huarui.initial.util.InitialVO;

class InitialDaoImpl extends BaseDaoImpl implements IInitialDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<InitialVO> getInitialListByCondition(Map map) {
		/**
		 * TODO : query a message using queryForObject
		 */
		return this.getSqlMapClientTemplate().queryForList(namespace+".getInitialByCondition", map);
	}

	@SuppressWarnings("unchecked")
	@Override
	public InitialVO getInitialByCondition(Map map) {
	     List<InitialVO> list=this.getInitialListByCondition(map);
		return list.size()>0?list.get(0):null;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Integer getInitialCountByCondition(Map map) {
		return (Integer) this.getSqlMapClientTemplate().queryForObject(namespace+".getInitialCountByCondition",map);
	}

	@SuppressWarnings("unchecked")
	@Override
	public BigDecimal getTotalMountByConditions(Map map) {
		return (BigDecimal) this.getSqlMapClientTemplate().queryForObject(namespace+".getTotalMountByConditions");
	}

	@SuppressWarnings("unchecked")
	@Override
	public int deleteInitialById(Map map) {
		return this.getSqlMapClientTemplate().delete(namespace+".deleteInitialById", map);
	}
	
}
